package com.tjmc.nsia.core.service.impl;

import com.tjmc.nsia.core.dao.entity.NsiaChat;
import com.tjmc.nsia.core.schedule.AsyncFactory;
import com.tjmc.nsia.core.schedule.AsyncManager;
import com.tjmc.nsia.core.service.NsiaInteractionService;
import com.tjmc.nsia.core.utils.BigmodelUtils;
import org.springframework.stereotype.Service;

/**
 * @author Luc
 * @version 1.0
 * @date 2024-06-21 11:19
 */
@Service
public class NsiaInteractionServiceImpl implements NsiaInteractionService {

    @Override
    public String syncResponse(String question) {
        return BigmodelUtils.syncInvoke(question);
    }

    @Override
    public void streamResponse(NsiaChat nsiaChat, String employeeCode) {
        AsyncManager.me().execute(AsyncFactory.streamResponse(nsiaChat, employeeCode));
    }

    @Override
    public void webSocketResponse(NsiaChat nsiaChat, String userId) {
        AsyncManager.me().execute(AsyncFactory.websocketResponse(nsiaChat, userId));
    }
}
